<template>
  <div></div>
</template>

<script lang="ts" setup>
let socket: any = null;

import { onMounted, ref } from "vue";
onMounted(() => {
  socket = new WebSocket("ws://1.116.178.22:9103/websocket/1");
  socket.addEventListener("open", (event) => {
    console.log("连接到服务器");
  });

  socket.addEventListener("message", (event) => {
    // output.innerHTML = ;
    console.log(`收到服务器消息: ${event.data}`);
  });

  socket.addEventListener("close", (event) => {
    console.log("与服务器断开连接");
  });
});
</script>

<style lang="scss" scoped></style>
